import { defHttp } from '/@/utils/http/axios';
import setting from '/@/settings/projectSetting';
import { ContentTypeEnum } from '/@/enums/httpEnum';

const Api = {
  formListForm: `${setting.interfacePrefix}/form/listForm`, //表单列表页
  formEditFormPage: `${setting.interfacePrefix}/form/editFormPage`, //表单列表编辑详情
  formUpdateForm: `${setting.interfacePrefix}/form/updateForm`, //表单列表修改
  formCreateForm: `${setting.interfacePrefix}/form/createForm`, //表单列表新增
  formDel: `${setting.interfacePrefix}/form/del`, //表单列表删除
  formCheckCode: `${setting.interfacePrefix}/form/checkCode`, //表单列表校验code
  formMacroListSequence: `${setting.interfacePrefix}/flow/macro/listSequence`, //自动编号 工作流序列号种类选择
  basicdataListByType: `${setting.interfacePrefix}/basicdata/listByType`, //基础数据 选择
  visualListModule: `${setting.interfacePrefix}/visual/listModule`, //嵌套表格里的接口 列出模块
  visualSyncModulePvg: `${setting.interfacePrefix}/visual/syncModulePvg`, //嵌套表格里的接口 同步模块
  visualDelModuleBatch: `${setting.interfacePrefix}/visual/delModuleBatch`, //嵌套表格里的接口 删除模块
  adminListRoleByUnitCode: `${setting.interfacePrefix}/admin/listRoleByUnitCode`, //角色中用户选择框 角色选择接口
  formGetFieldsOfDeptSelectCtl: `${setting.interfacePrefix}/form/getFieldsOfDeptSelectCtl`, //用户选择中:联动部门字段接口
  visualFormulaList: `${setting.interfacePrefix}/visual/formula/list`, //函数宏控件中的接口
  formGetFieldsByNumeric: `${setting.interfacePrefix}/form/getFieldsByNumeric`, //取得表单中的所有数值型字段
  visualGetColsForSetup: `${setting.interfacePrefix}/visual/getColsForSetup`, //动态表头获取
  relateModule: `${setting.interfacePrefix}/visual/relateModule`, //使模块关联
  visualSetCols: `${setting.interfacePrefix}/visual/setCols`, //动态表头保存

  formGetFieldsForManage: `${setting.interfacePrefix}/form/getFieldsForManage`, //字段管理获取
  formUpdateFields: `${setting.interfacePrefix}/form/updateFields`, //字段管理更新
  formGetViewRule: `${setting.interfacePrefix}/form/getViewRule`, //视图则的数据
  formUpdateViewSetup: `${setting.interfacePrefix}/form/updateViewSetup`, //视图则的数据
  formListRemind: `${setting.interfacePrefix}/form/listRemind`, //到期提醒
  formCreateRemind: `${setting.interfacePrefix}/form/createRemind`, //到期提醒新增
  formEditRemindPage: `${setting.interfacePrefix}/form/editRemindPage`, //到期提醒编辑
  formUpdateRemind: `${setting.interfacePrefix}/form/updateRemind`, //到期提醒编辑保存
  formDelRemind: `${setting.interfacePrefix}/form/delRemind`, //到期提醒删除
  formGetCheckSetup: `${setting.interfacePrefix}/form/getCheckSetup`, //验证规则
  formUpdateCheckSetup: `${setting.interfacePrefix}/form/updateCheckSetup`, //验证规则

  formGetFormSchemas: `${setting.interfacePrefix}/form/getFormSchemas`, //获取表单
  formUpdateFormSchemas: `${setting.interfacePrefix}/form/updateFormSchemas`, //保存表单
  checkFormSchemas: `${setting.interfacePrefix}/form/checkFormSchemas`, //保存表单前检查

  formGetWriteBackPage: `${setting.interfacePrefix}/form/getWriteBackPage`, //回写设置
  formUpdateWriteBack: `${setting.interfacePrefix}/form/updateWriteBack`, //回写设置
  formClearWriteBack: `${setting.interfacePrefix}/form/clearWriteBack`, //回写设置
  formGetWriteBackPageByDb: `${setting.interfacePrefix}/form/getWriteBackPageByDb`, //回写设置
  formUpdateWriteBackByDb: `${setting.interfacePrefix}/form/updateWriteBackByDb`, //回写设置
  formClearWriteBackByDb: `${setting.interfacePrefix}/form/clearWriteBackByDb`, //回写设置

  visualGetScript: `${setting.interfacePrefix}/visual/getScript`, //事件脚本获取
  visualUpdateScript: `${setting.interfacePrefix}/visual/updateScript`, //事件脚本更新

  formViewGetViewById: `${setting.interfacePrefix}/formView/getViewById`, //视图中 获取视图
  formViewUpdate: `${setting.interfacePrefix}/formView/update`, //视图中 更新视图
  formViewList: `${setting.interfacePrefix}/formView/list`, //视图中 列表
  formViewCreate: `${setting.interfacePrefix}/formView/create`, //视图中 新增
  formViewDel: `${setting.interfacePrefix}/formView/del`, //视图中 删除
  formViewDelBatch: `${setting.interfacePrefix}/formView/delBatch`, //视图中 批量删除
  generateDefaultView: `${setting.interfacePrefix}/formView/generateDefaultView`, //视图中 新增默认视图

  formViewGetViewRule: `${setting.interfacePrefix}/formView/getViewRule`, //视图中 取得显示规则
  formViewUpdateViewSetup: `${setting.interfacePrefix}/formView/updateViewSetup`, //视图中 保存显示规则
  formViewGetElements: `${setting.interfacePrefix}/formView/getElements`, //规则 则的数据 取出视图中的元素

  formGetFieldsByBasicTree: `${setting.interfacePrefix}/form/getFieldsByBasicTree`, //取得表单中的树型基础数据字段

  checkUeditorForm: `${setting.interfacePrefix}/form/checkUeditorForm`, //检查ueditor编辑的表单内容
  updateUeditorForm: `${setting.interfacePrefix}/form/updateUeditorForm`, //保存ueditor编辑的表单内容
  getFormContent: `${setting.interfacePrefix}/form/getFormContent`, //取表单内容

  formListTable: `${setting.interfacePrefix}/form/listTable`, //获取当前数据库所有表
  formGetTableFields: `${setting.interfacePrefix}/form/getTableFields`, //获取表字段

  formGetFieldsByFlowTypeCode: `${setting.interfacePrefix}/form/getFieldsByFlowTypeCode`, //取得流程表单中的所有字段
  formGetNestFieldsByTypeCode: `${setting.interfacePrefix}/form/getNestFieldsByTypeCode`, //取得流程嵌套表单中的所有字段
  formGetNestFormCode: `${setting.interfacePrefix}/form/getNestFormCode`, //取得主表中嵌套表的表单编码
  formGetFieldsByDate: `${setting.interfacePrefix}/form/getFieldsByDate`, //取得表单日期型字段
};

export const getFormListForm = (params?: any) =>
  defHttp.post<any>({ url: Api.formListForm, params });
export const getFormEditFormPage = (params?: any) =>
  defHttp.post<any>({ url: Api.formEditFormPage, params });
export const getFormUpdateForm = (params?: any) =>
  defHttp.post<any>({ url: Api.formUpdateForm, params });
export const getFormCreateForm = (params?: any) =>
  defHttp.post<any>({ url: Api.formCreateForm, params });
export const getFormDel = (params?: any) => defHttp.post<any>({ url: Api.formDel, params });
export const getFormCheckCode = (params?: any) =>
  defHttp.post<any>({ url: Api.formCheckCode, params });

export const getFormMacroListSequence = (params?: any) =>
  defHttp.post<any>({ url: Api.formMacroListSequence, params });
export const getBasicdataListByType = (params?: any) =>
  defHttp.post<any>({ url: Api.basicdataListByType, params });
export const getVisualListModule = (params?: any) =>
  defHttp.post<any>({ url: Api.visualListModule, params });
export const getVisualSyncModulePvg = (params?: any) =>
  defHttp.post<any>({ url: Api.visualSyncModulePvg, params });
export const getVisualDelModuleBatch = (params?: any) =>
  defHttp.post<any>({ url: Api.visualDelModuleBatch, params });
export const getAdminListRoleByUnitCode = (params?: any) =>
  defHttp.post<any>({ url: Api.adminListRoleByUnitCode, params });
export const getFormGetFieldsOfDeptSelectCtl = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetFieldsOfDeptSelectCtl, params });
export const getVisualFormulaList = (params?: any) =>
  defHttp.post<any>({ url: Api.visualFormulaList, params });
export const getFormGetFieldsByNumeric = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetFieldsByNumeric, params });
export const getVisualGetColsForSetup = (params?: any) =>
  defHttp.post<any>({ url: Api.visualGetColsForSetup, params });
export const relateModule = (params?: any) => defHttp.post<any>({ url: Api.relateModule, params });
export const getVisualSetCols = (params?: any) =>
  defHttp.post<any>({
    url: Api.visualSetCols,
    params,
    // headers: { 'Content-Type': ContentTypeEnum.JSON },
  });

export const getFormGetFieldsForManage = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetFieldsForManage, params });
export const getFormUpdateFields = (params?: any) =>
  defHttp.post<any>({
    url: Api.formUpdateFields,
    params,
    headers: { 'Content-Type': ContentTypeEnum.JSON },
  });
export const getFormGetViewRule = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetViewRule, params });
export const getFormUpdateViewSetup = (params?: any) =>
  defHttp.post<any>({ url: Api.formUpdateViewSetup, params });
export const getFormListRemind = (params?: any) =>
  defHttp.post<any>({ url: Api.formListRemind, params });

export const getFormCreateRemind = (params?: any) =>
  defHttp.post<any>({ url: Api.formCreateRemind, params });
export const getFormEditRemindPage = (params?: any) =>
  defHttp.post<any>({ url: Api.formEditRemindPage, params });
export const getFormUpdateRemind = (params?: any) =>
  defHttp.post<any>({ url: Api.formUpdateRemind, params });

export const getFormDelRemind = (params?: any) =>
  defHttp.post<any>({ url: Api.formDelRemind, params });
export const getFormGetCheckSetup = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetCheckSetup, params });
export const getFormUpdateCheckSetup = (params?: any) =>
  defHttp.post<any>({ url: Api.formUpdateCheckSetup, params });
export const getFormGetFormSchemas = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetFormSchemas, params });
export const getFormUpdateFormSchemas = (params?: any) =>
  defHttp.post<any>({ url: Api.formUpdateFormSchemas, params });
export const checkFormSchemas = (params?: any) =>
  defHttp.post<any>({ url: Api.checkFormSchemas, params });

export const getFormGetWriteBackPage = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetWriteBackPage, params });
export const getFormUpdateWriteBack = (params?: any) =>
  defHttp.post<any>({ url: Api.formUpdateWriteBack, params });
export const getFormClearWriteBack = (params?: any) =>
  defHttp.post<any>({ url: Api.formClearWriteBack, params });
export const getFormGetWriteBackPageByDb = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetWriteBackPageByDb, params });
export const getFormUpdateWriteBackByDb = (params?: any) =>
  defHttp.post<any>({ url: Api.formUpdateWriteBackByDb, params });
export const getFormClearWriteBackByDb = (params?: any) =>
  defHttp.post<any>({ url: Api.formClearWriteBackByDb, params });
export const getVisualGetScript = (params?: any) =>
  defHttp.post<any>({ url: Api.visualGetScript, params });
export const getVisualUpdateScript = (params?: any) =>
  defHttp.post<any>({ url: Api.visualUpdateScript, params });

export const getFormViewGetViewById = (params?: any) =>
  defHttp.post<any>({ url: Api.formViewGetViewById, params });
export const getFormViewUpdate = (params?: any) =>
  defHttp.post<any>({ url: Api.formViewUpdate, params });
export const getFormViewList = (params?: any) =>
  defHttp.post<any>({ url: Api.formViewList, params });
export const getFormViewGetViewRule = (params?: any) =>
  defHttp.post<any>({ url: Api.formViewGetViewRule, params });
export const getFormViewUpdateViewSetup = (params?: any) =>
  defHttp.post<any>({ url: Api.formViewUpdateViewSetup, params });
export const getFormViewCreate = (params?: any) =>
  defHttp.post<any>({ url: Api.formViewCreate, params });
export const getFormViewDel = (params?: any) => defHttp.post<any>({ url: Api.formViewDel, params });
export const getFormViewDelBatch = (params?: any) =>
  defHttp.post<any>({ url: Api.formViewDelBatch, params });
export const generateDefaultView = (params?: any) =>
  defHttp.post<any>({ url: Api.generateDefaultView, params });

export const getFormViewGetElements = (params?: any) =>
  defHttp.post<any>({ url: Api.formViewGetElements, params });
export const getFormGetFieldsByBasicTree = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetFieldsByBasicTree, params });
export const checkUeditorForm = (params?: any) =>
  defHttp.post<any>({ url: Api.checkUeditorForm, params });
export const updateUeditorForm = (params?: any) =>
  defHttp.post<any>({ url: Api.updateUeditorForm, params });
export const getFormContent = (params?: any) =>
  defHttp.post<any>({ url: Api.getFormContent, params });
export const getFormListTable = (params?: any) =>
  defHttp.post<any>({ url: Api.formListTable, params });
export const getFormGetTableFields = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetTableFields, params });
export const getFormGetFieldsByFlowTypeCode = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetFieldsByFlowTypeCode, params });
export const getFormGetNestFieldsByTypeCode = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetNestFieldsByTypeCode, params });
export const getFormGetNestFormCode = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetNestFormCode, params });
export const getFormGetFieldsByDate = (params?: any) =>
  defHttp.post<any>({ url: Api.formGetFieldsByDate, params });
